<?php

class admin_theme extends template
{

    public function display()
    {
        $config = bone::get_config('system');
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php echo $this->get_title() . ' - ' . $config->site_name; ?></title>

<script type="text/javascript" language="javascript" src="../js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="../js/jquery.cookie.js"></script>

<link type="text/css" rel="stylesheet" href="css/global.css" />
<script type="text/javascript" language="javascript" src="js/global.js"></script>

<link type="text/css" rel="stylesheet" href="theme/css/theme.css" />
<script type="text/javascript" language="javascript" src="theme/js/theme.js"></script>

<?php $this->head(); ?>
</head>
<body><?php $this->body(); ?></body>
</html>
<?php
    }
    
    protected function body()
    {
        ?>
<div class="theme-north"><?php $this->north(); ?></div>
<div class="theme-middle"><?php $this->middle(); ?></div>
<?php
    }

    protected function north()
    {
        $my = bone::get_admin();
        ?>
<div class="theme-north-header">
	你好: <?php echo $my->name; ?> &nbsp; &nbsp; <a href="./?action=user.access.logout">退出</a>
</div>

<div class="theme-north-menu" id="north-menu">
    <ul>
    	<li><a href="./?action=user.manager.dashboard" style="cursor:pointer;">后台首页</a></li>
    	<li class="node"><a href="javascript:;">菜单</a>
    	<ul>
    		<li><a href="./?action=system.menu.listing">菜单列表</a></li>
    		<li><a href="./?action=system.menu_group.listing">菜单分组管理</a></li>
    	</ul>
    	</li>
    	<li class="node"><a href="javascript:;">主题</a>
    	<ul>
    		<li><a href="./?app=themes&task=listing">已安装的主题</a></li>
    		<li><a href="./?app=themes&task=listing">在线安装新主题</a></li>
    	</ul>
    	</li>
    	<li class="node"><a href="javascript:;">应用</a>
    	<ul>
    		<li><a href="./?action=system.app.listing">已安装的程序</a></li>
    		<li><a href="./?action=system.app.remote_listing">安装新应用</a></li>
    	</ul>
    	</li>
    	<li class="node"><a href="javascript:;">系统配置</a>
    	<ul>
    		<li><a href="./?action=system.config.system">配置系统参数</a></li>
    		<li><a href="./?action=system.config.mail">配置邮件参数</a></li>
    		<li><a href="./?action=system.log.listing">查看日志</a></li>
    	</ul>
    	</li>
    	<li class="node"><a href="javascript:;">帮助</a>
    	<ul>
    		<li><a href="http://www.mrbone.org/" target="_blank">官方网站</a></li>
    		<li><a href="http://www.1024i.com/" target="_blank">技术支持</a></li>
    		<li><a href="javascript:;" onclick="javasscript:alert('您正在使用骨头系统 V<?php echo bone::get_version(); ?>');">关于</a></li>
    	</ul>
    	</li>
    	
    </ul>
</div>
<?php
    }

    // 网页的中部
    protected function middle()
    {
        ?>
<div class="theme-west"><?php $this->west(); ?></div>

<div class="theme-center">
    <div class="center-title"><div class="title-icon"><?php echo $this->get_title(); ?></div></div>
	<div class="center-body"><?php
$this->message();
$this->center();
?></div>
</div>
<?php
    }

    protected function west()
    {
        $model_app = bone::get_admin_model('system', 'app');
        $apps = $model_app->get_apps();
        ?>
<div class="west-title"><div class="title-icon">已安装的应用</div></div>

<div class="theme-west-tree" id="west-tree">
	<ul>
	<?php
    foreach ($apps as $app)
    {
        ?>
		<li class="node" id="app-<?php echo $app->name; ?>">
			<div><a href="javascript:;"><img src="<?php echo $app->icon; ?>" /><?php echo $app->label; ?></a></div>
			<ul>
			<?php
            $menus = $app->get_menus();
            foreach ($menus as $menu)
            {
            ?>
				<li><a href="<?php echo $menu->url; ?>"><img src="<?php echo $menu->icon; ?>" /><?php echo $menu->name; ?></a></li>
			<?php
            }
            ?>
			</ul>
		</li>
		<?php
        }
        ?>
	</ul>
</div>
<?php
    }

    protected function message()
    {
        $message = $this->get('_message');
        if($message!==null) echo '<div class="theme-message theme-message-' . $message->type . '"><a class="close" href="javascript:;">&times;</a>' . $message->body . '</div>';
    }



}

?>